<template>
  <div>
    <FormDetailNoImg :dataModel="[dataModel.detailShowInfo]" />
    <FormDetailNoImg :dataModel="[dataModel.checkDeviceShowInfo]" />
    <FormDetailNoImg :dataModel="[dataModel.checkOperateShowInfo]" />
    <FormDetailNoImg :dataModel="[dataModel.checkItemsShowInfo]" />
  </div>
</template>

<script>
import FormDetailNoImg from "@/components/formEdit/formDetailNoImg";
export default {
  components: { FormDetailNoImg },
  props: ["dataModel"],
  created() {
    console.log("++++++++++++");
    console.log(this.$route.fullPath);
    const id = localStorage.getItem(this.$route.fullPath);
    this.$store
      .dispatch("device_preserve_plan/requestDetailInfo", id)
      .then(res => {
        //组装展示的数据到结构中
        console.log("查询的保养详情", res.data);
        //基础信息
        this.dataModel.detailShowInfo.content.forEach(e => {
          //把请求的值赋给常量
          e.value = res.data[e.name];
        });
        //保养设备
        this.dataModel.checkDeviceShowInfo.tableData = [res.data];
        //点检人员,产品改为了表格- -
        this.dataModel.checkOperateShowInfo.tableData = [res.data];
        //点检项
        this.dataModel.checkItemsShowInfo.tableData = res.data.planItems;
        console.log("点检详情", this.dataModel);
      })
      .catch(err => {});
  }
};
</script> 